<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo CHtml::encode($this->pageTitle); ?></title>
<meta name="keywords" content="<?php echo CHtml::encode($this->pageKeyword);?>" />
<meta name="description" content="<?php echo CHtml::encode($this->pageDesc); ?>">
<link href="<?php echo Yii::app()->homeUrl ?>/css/style/style_one.css" rel="stylesheet" type="text/css" />
<link href="<?php echo Yii::app()->homeUrl ?>/css/style/style_product.css" rel="stylesheet" type="text/css" />
<link href="<?php echo Yii::app()->homeUrl ?>/css/style/style.css" rel="stylesheet" type="text/css" />
<?php if($this->pre_module_url!='/home'){?>
	<?php if($this->pre_module_url!='/member'){?>
	<link href="<?php echo Yii::app()->homeUrl ?>/css/style/style_company.css" rel="stylesheet" type="text/css" />
	<?php }?>
    <?php if($this->pre_module_url!='/company'){?>
	<link href="<?php echo Yii::app()->homeUrl ?>/css/style/style_members.css" rel="stylesheet" type="text/css" />
    <?php }?>
<?php }?>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->homeUrl?>/css/form.css" />
<!--[if ie 6]>
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/style/ie6.css">
<![endif]-->
<?php cs()->registerCoreScript('jquery') ?>
<script type="text/javascript" src="<?php echo Yii::app()->homeUrl ?>/js/MSClass.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->homeUrl ?>/js/common.js"></script>
<!-- 弹框控件 -->
<link href="/js/artdialog/skins/default.css" rel="stylesheet" />
<script src="/js/artdialog/artDialog.min.js"></script>
<script src="/js/jquery-ui-1.9.2.custom.js"></script>
<script src="/js/art_show.js"></script>
</head>
<body>
<!--顶部start-->
<div class="site_topbar">
    <div class="w_960 o_a">
        <div class="left f_l"><a href="javascript:" title=""><b class="ico ico_collect"></b>收藏本站</a><span class="welcome">您好<?php if(user()->getName() !='Guest'){echo user()->getName();} ?>， 欢迎来到<?php echo F::setting('sitename') ?>！</span></div>
        <div class="right f_r">
            <ul id="head_menu">
                <?php if (Yii::app()->user->isGuest){ ?>
                <li class="item"><?php echo CHtml::link('登录','/home/user/login');?></li>
                <li class="item"><?php echo CHtml::link('免费注册','/home/user/registerone');?></li>

                <?php }else{ ?>
                	<?php if (isset(Yii::app()->user->memgroup)) { //判断一个用户是否是买家会员?>
                		<li class="item"><?php echo CHtml::link('会员中心','/member/index');?></li>
                	<?php }?>
                	<?php if (isset(Yii::app()->user->comgroup)) { //判断一个用户是否是商家用户?>
	                    <li class="item"><?php echo CHtml::link('商家中心','/company/index');?></li>
	                <?php }?>
                <li class="item"><?php echo CHtml::link('退出','/home/user/logout');?></li>
                <?php } ?>
                <li class="item menu cart">
                    <a class="link" href="/cart/" title=""><b class="ico ico_cart"></b>购物车 <strong id="cart_num" onload="cartNum">0</strong> 件<b class="ico ico_updown"></b></a>
                    <div class="sub_menu hide" id="cart-form">
                        <?php $this->renderPartial('//layouts/_cart'); ?>
                    </div>
                </li>
                <li class="item menu my_account">
                    <?php echo CHtml::link('我的帐户<b class="ico ico_updown"></b>','/member/index',array('class'=>'link'));?>
                    <ul class="sub_menu hide line_22">
                        <?php (isset(Yii::app()->user->userid))?$statusAmount = Order::model()->getOrderAmountOfStatus(Yii::app()->user->userid,1):$statusAmount["notpay"] = 0;?>
                        <li><?php echo CHtml::link('已买到的宝贝','/member/index/orders');?></li>
                        <li><?php echo CHtml::link('待付款宝贝('.$statusAmount["notpay"].')','/member/index/orders');?></li>
                        <li><?php echo CHtml::link('系统消息('.MsgLog::model()->getMsgLogNum().')','/member/msgLog/admin');?></li>
                    </ul>
                </li>
                <li class="item menu site_map">
                    <a class="link" href="javascript:" title="">网站导航<b class="ico ico_updown"></b></a>
                    <ul class="sub_menu hide line_22">
                        <li><?php echo CHtml::link('首页','/');?></li>
                        <li><?php echo CHtml::link('团购',array('/home/tuan/index'))?></li>
                        <li><?php echo CHtml::link('促销专区',array('/home/discount/index'))?></li>
                        <li><?php echo CHtml::link('限时抢购',array('/home/promotion/index'))?></li>
                        <li><?php echo CHtml::link('资讯中心','/home/news/');?></li>
                        <li><?php echo CHtml::link('服务中心','/home/help/');?></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</div>
<!--顶部end-->
<!--头部start-->
<div class="header">
    <div class="w_960 o_a">
        <h1 class="logo f_l">
            <?php echo l(CHtml::image(F::setting('sitelogo'),app()->name),app()->homeUrl,array('title'=>app()->name))?></h1>
        <div class="search_bar c_f">
            <form method="get" name="" id="search-form-main" action="/home/product/search/" target="_blank">
                <div class="select"><select style="display:none;" id="headSearch"><option selected="selected" value="0">找产品</option><option value="1">找资讯</option></select></div>
                <ul class="search_p"></ul>
				<input name="keyword" type="text" class="t_ipt" id="search-keyword" autocomplete="off" onblur="if(this.value==''){this.value='请输入搜索关键字';this.style.color='#bebebe'}" onfocus="if(this.value=='请输入搜索关键字'){this.value='';this.style.color='#333'}" value="<?php if(isset($_GET['keyword'])){echo $_GET['keyword'];} else{ echo "请输入搜索关键字";}?>" />
                <button type="submit" class="btn_srh">搜索</button>
            </form>
        </div>
    </div>
</div>
<!--头部end-->
    <?php echo $content; ?>

<script type="text/javascript" src="/js/select.jQuery.js"></script>
<script type="text/javascript" src="/js/LoadImage.js"></script>
<script type="text/javascript" src="/js/backToTop.js"></script>
<script type="text/javascript">
$(function(){
    $("#head_menu").headmenu(1);
    $('#headSearch').selectbox();
    $("#allsort").Prolist();
    $(".index_snapup").Prolist();
    $("#proSort").Prolist();
    $("#index_news").TabADS();
	$("#newsTab").TabADS();
	$('#proTab').TabADS2();
	$('#favShopTab').TabADS4();
	$('#refundTab').TabADS2();
});

//删除购物车商品
function deletesCart(rowid){                   
    $.ajax({
        type:"POST",
        url: "<?php echo Yii::app()->createUrl('/ajax/AjaxDelCart/') ?>",
        data:"rowid="+rowid,
        success: function(msg){
            //alert(msg);
            //$mycart = msg;
           $('#cart-form').html(msg);
        }
    })
	
	$.ajax({
		type:"POST",
		url: "<?php echo Yii::app()->createUrl('/ajax/AjaxCartNum/') ?>",
		dataType: 'html',
		success: function(msg){
			//alert(msg);
		   $('#cart_num').html(msg);
		}
	})
};
//加载购物车商品数量
window.onload = function cartNum()
{
	$.ajax({
		type:"POST",
		url: "<?php echo Yii::app()->createUrl('/ajax/AjaxCartNum/') ?>",
		success: function(msg){
			//alert(msg);
		   $('#cart_num').html(msg);
		}
	})
};


$(function(){
	$(".search_p").hide();
	$("#search-keyword").click().live('keyup',function(){
		keyword = $.trim($('#search-keyword').val());
		if(keyword == ''){
            $(".search_p").hide();
        }else{
			$(".search_p").show();
			$.ajax({
				type:"POST",
				url: "<?php echo Yii::app()->createUrl('/ajax/AjaxSearch/') ?>",
				data:"keyword="+keyword,
				success: function(msg){
				   $('.search_p').html(msg);
				}
			})
		}
	});
	
	
    var index = 0;
	$("#search-keyword").keydown(function (event) {//上下键获取焦点  
        var key = event.keyCode;
        if (key == 13) Search(); /*回车搜索*/  
		if (key == 38) { /*向上按钮*/  
			index--;
            if (index == -1) index = 4; //到顶了，  
		} else if (key == 40) {/*向下按钮*/ 
			index++;
            if (index == 5) index = 0; //到底了
		}
        var li = $(".search_p").find("li:eq("+index+")");  
        li.css("background", "#E8F4FC").siblings().css("background", "");  
        li.addClass("search-current");
	});

});
</script>
</body>
</html>